{{ extend '../_layouts/home.html' }}

{{ block 'title' }}{{ '已创建话题' }}{{ /block }}

{{ block 'body' }} 
<section class="container">
    {{ include '../_partials/setting-avatar.html' }}
    <div class="col-md-9">
        <div class="list-container">
            <ul class="list-tab">
                <li><a href="/settings/profile">个人主页</a></li>
                <li><a href="/myFollow">关注</a></li>
                <li><a href="/myFans">粉丝</a></li>
                <li><a href="/myCollection">收藏</a></li>
                <li><a href="/settings/admin">修改密码</a></li>
                <li><a href="/settings/createdTopics" class="active">已创建话题</a></li>
                <li><a href="/settings/partTopics">已参与话题</a></li>
            </ul>    
        </div>
        <div class="bg3Color margintop">
            <div class="user_header">
                <ul class="breadcrumb">
                    <li>{{currentuser.nickname}}创建的话题</li>
                    <span id="follow_num" class="dis-block pullme-right"></span>
                </ul>
            </div>
            {{ if topic!='' }}
            <div class="topic_create">
                <ul class="topic-list" id="listInfo">
                    {{ each topic }}
                    <li class="createdTopic-list-item">
                        <div class="created-header">
                            <a href="/topic/show/{{ formateId($value._id) }}" class="createdTopic_title pullme-left" title="{{$value.title}}">{{$value.title}}</a>
                            <span class="user_createdTime">{{fromNowFormat($value.created_time)}}</span>
                        </div>
                        <div class="newtopic-title-wrapper">
                            <div class="clear margintop-limit">
                                <span class="created-type">{{$value.type}}</span>
                                <span>阅读数 <span class="greenColor">{{$value.click_num}}</span></span>
                                <span class="vertical-divider">|</span class="">
                                <span>回复数 <span class="greenColor">{{$value.call_num}}</span></span>
                                <span class="vertical-divider">|</span class="">
                                <span>
                                    <a href="/topic/edit/{{ formateId($value._id) }}" class="edit-topic2">
                                        <i class="glyphicon glyphicon-pencil"></i> 编辑
                                    </a>
                                </span>
                                <span class="vertical-divider">|</span class="">
                                <span>
                                    <a href="/topic/delete/{{ formateId($value._id) }}" class="delete-topic">
                                        <i class="glyphicon glyphicon-trash"></i> 删除
                                    </a>
                                </span>
                            </div>
                        </div>
                    </li>
                    {{/each }}
                </ul>
                <div class="pagehelper">
                    <div id="demo5"></div>
                </div>
            </div>
            {{ else }}
            <div class="topic_create">
                <p class="topic_none">无话题</p>
            </div>
            {{ /if }}
        </div>
    </div>
</section>
{{ /block }}
{{ block 'script' }}
<script>
$('#follow_num').text('共' + $('.createdTopic-list-item').length + '条')
layui.use(['laypage', 'layer'], function(){
    var laypage = layui.laypage
    ,layer = layui.layer;      
    //总页数大于页码总数
    laypage.render({
        elem: 'demo5',
        limit: '{{ limit }}',  // 每页显示的条数
        curr: '{{ currentPage || 1 }}',  // 当前页，页面点击
        count: '{{ total }}', //数据总数
        jump: function(obj, first){
            if (!first) {  //首次不执行
                window.location.href = '?page=' + obj.curr
            }
        }
    });
});
</script>
{{ /block }}
